package com.it.demo;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author げっしょく
 * @date 2021/8/8
 */
public class Demo4 {
    public static void main(String[] args) {
        song song = new song();
        for (int i = 0; i < 100; i++) {
            new Thread(song).start();
        }
    }
}


class song implements Runnable{
    AtomicInteger ai = new AtomicInteger(0);
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            int i1 = ai.incrementAndGet();
            System.out.println("第"+ i1 +"次送冰激凌");
        }
    }
}
